#include<iostream>
using namespace std;

int cmmdc(int a,int b)
{while(a!=b)
  if(a>b)
  a=a-b;
  else
  b=b-a;
return a;}
int main()
{
 int i,j,n,x[10],y[10];
 cout<<"Dati numarul de elemente ale tabloului ";cin>>n;
for(i=1;i<=n;i++)
{
cout<<"x["<<i<<"]= ";
cin>>x[i];
}

i=1;
j=1;
while(i<=n)
{ y[j]=x[i];
  y[i+1]=cmmdc(x[i],x[i+1]);
  i=i+1;
  j=j+2;
}
cout<<"Elementele sunt: "<<endl;
for(i=1;i<j;i++) 
cout<<y[i]<<" ";
}


